Mac OS 8.5 Technote: Part IX

Copyright 1998 by Apple Computer, Inc. All Rights Reserved.

[Previous section] [Mac OS 8.5 Contents Page] [Next section]

Alias Manager

The Alias Manager is the part of the operating system that communicates with the File Manager to maintain alias records used to store references to file and folder locations. The Alias Manager does not create Finder alias files: the Finder creates these files and stores alias records created by the Alias Manager in them.
  • The Alias Manager's search methods have been broadened to include cases where the simple search for an existing file on a mounted volume fails, yet the absolute path stored in the alias record resolves to an existing file. In these cases, the Alias Manager will return a reference to the file found using the absolute path.

  • The Alias Manager API now provides the following new routines:

    IsAliasFile

    OSErr IsAliasFile(const FSSpec *fileFSSpec,
                      Boolean *aliasFileFlag,
                      Boolean *folderFlag);

    fileFSSpec is a pointer to a file specification record referring to a file.

    aliasFileFlag is a pointer to a Boolean variable set to true if the file is an alias file created by the Finder.

    folderFlag is a pointer to a Boolean variable set to true if the alias refers to folder.

    The function IsAliasFile sets *aliasFileFlag to true if the file referred to by the fileFSSpec parameter is an alias file created by the Finder.

    ResolveAliasWithMountFlags

    OSErr ResolveAliasWithMountFlags(const FSSpec *fromFile,
                      AliasHandle alias,
                      FSSpec *target,
                      Boolean *wasChanged,
                      unsigned long mountFlags);

    fromFile, if not NULL, is used to resolve relative aliases.

    alias is the AliasHandle to resolve.

    target contains a pointer to an FSSpec record that will refer to the file or directory referred to by the alias when the function completes successfully.

    wasChanged refers to a Boolean variable that will be set to true if the alias record has been modified by ResolveAliasWithMountFlags.

    mountFlags can be set to kResolveAliasFileNoUI to prevent any user interaction, including disk switch alerts, while the alias is being resolved.

    The routine ResolveAliasWithMountFlags is identical to ResolveAlias with the exception that it provides the mountFlags parameter, allowing callers to suppress disk switch alerts.

    ResolveAliasFileWithMountFlags

    OSErr ResolveAliasFileWithMountFlags(FSSpec *theSpec,
                      Boolean resolveAliasChains,
                      Boolean *targetIsFolder,
                      Boolean *wasAliased,
                      unsigned long mountFlags);

    theSpec on input refers to a FSSpec record that refers to an alias file. If the function completes successfully, it will refer to the file or the directory that was referred to by the alias file.

    resolveAliasChains turns on or off resolution of chains of alias files (for example, an alias file that refers to an alias file that finally refers to the target file).

    targetIsFolder points to a Boolean variable that will be set to true if the target referenced by the alias file was found to be a folder.

    wasAliased returns true if theSpec referred to an alias file.

    mountFlags can be set to kResolveAliasFileNoUI to prevent any user interaction, including disk switch alerts, while the alias is being resolved.

    The routine ResolveAliasFileWithMountFlags is identical to ResolveAliasFile with the exception that it provides the mountFlags parameter, allowing callers to suppress disk switch alerts.

COMPATIBILITY NOTE
Before calling IsAliasFile, ResolveAliasWithMountFlags, or ResolveAliasFileWithMountFlags, developers must determine if these routines are available by testing the Alias Manager gestalt value's gestaltAliasMgrResolveAliasFileWithMountOptions bit. Also, see the InterfaceLib section for important information about linking with the new InterfaceLib.


[Previous section] [Mac OS 8.5 Contents Page] [Next section]

To contact us, please use the Contact Us page.